package com.admin.controller.export;

import com.admin.common.exception.BizException;
import com.admin.service.export.ExportService;
import com.admin.vo.ResultEnum;
import com.admin.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Objects;

/**
 * @Author: weiyang
 * @Date: 2022/07/08/10:22
 * @Description:
 */
@Api(description = "导出")
@RestController
@RequestMapping(value = "/export")
public class ExportController {
    private Logger logger = LoggerFactory.getLogger(ExportController.class);

    @Autowired
    private ExportService exportService;

    @ApiOperation(value = "区县评分管理-历史申报")
    @GetMapping(value = "/attachment")
    @ApiImplicitParam(name = "declareId", value = "申报id", required = true, dataType = "int", paramType = "query")
    public ResultVO<String> exportAttachment(Integer declareId) {
        if (Objects.isNull(declareId)) {
            throw new BizException(ResultEnum.PARAMETER_EMPTY);
        }

        return ResultVO.ok(exportService.exportAttachment(declareId));

    }

}
